
#ifndef CONFIG_PATH_PROCESS_HPP
#define CONFIG_PATH_PROCESS_HPP
#include "../common/null_type.hpp"
#include "../string.hpp"
#include <tchar.h>
namespace cfm{
	
	template<typename T>
	tstring GetModPath(T hMod)
	{
		tchar lpszDir[MAX_PATH] = {0};
		::GetModuleFileName( (HMODULE)hMod , lpszDir, MAX_PATH );
		tchar *tcbuff= _tcsrchr(lpszDir, '\\');
		if (tcbuff)
		{
			ZeroMemory( tcbuff, _tcslen(tcbuff)*sizeof(tchar) );
			tstring szCurPath = lpszDir;
			return szCurPath;
		}
		return _T("");
	}

	template<typename T>
	tstring GetModFileName(T hMod)
	{
		tchar lpszDir[MAX_PATH] = {0};
		::GetModuleFileName( (HMODULE)hMod , lpszDir, MAX_PATH );
		tchar *tcbuff= _tcsrchr(lpszDir, '\\');
		if (tcbuff)
		{
			tstring szCurPath = tcbuff;
			return szCurPath;
		}
		return _T("");
	}
}
#endif //CONFIG_PATH_PROCESS_HPP